package com.imooc.myo2o.web.superadmin;

import com.imooc.myo2o.common.JsonData;
import com.imooc.myo2o.util.ImageUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

@Controller
@RequestMapping("/image")
public class UploadImageController {

	@RequestMapping(value = "/upload", method = RequestMethod.GET)
	@ResponseBody
	public JsonData getAreaList(CommonsMultipartFile image,String addr) {
		String path = ImageUtil.generateThumbnail(image, addr);
		JsonData jsonData = new JsonData(true);
		jsonData.setData(path);
		return jsonData;
	}
}
